package itcz.example.pattern.structure_type.combination;

/**
 * @ClassName: MenuComponent
 * @Author: ITCZ
 * @Date: 2025-08-20
 * @Description: 组合模式-抽象根节点
 */
public abstract class MenuComponent {

    // 菜单名成
    protected String name;
    // 菜单层级
    protected int level;

    /**
     * 添加子菜单
     *
     * @param menuComponent 子菜单
     */
    public void add(MenuComponent menuComponent) {
        throw new UnsupportedOperationException();
    }

    /**
     * 移除子菜单
     *
     * @param menuComponent 子菜单
     */
    public void remove(MenuComponent menuComponent) {
        throw new UnsupportedOperationException();
    }

    /**
     * 获取子菜单
     *
     * @param i 子菜单索引
     * @return 子菜单
     */
    public MenuComponent getChild(int i) {
        throw new UnsupportedOperationException();
    }

    /**
     * 获取菜单或菜单项名称
     *
     * @return 名称
     */
    public String getName() {
        return name;
    }

    /**
     * 打印菜单项
     */
    public abstract void print();
}
